package ltu.m7011e.client.view;

import ltu.m7011e.client.presenter.UserInfoPresenter;
import ltu.m7011e.shared.SharedConstants;

import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.DecoratorPanel;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.Widget;

public class UserInfoView extends Composite implements UserInfoPresenter.Display {

	/**
	 * An instance of the Shared Constants.
	 */
	private final SharedConstants constants = GWT.create(SharedConstants.class);
	
	// Element of HeaderPanel
	private Button loginButton;
	private Button homeButton;
	private Label userInfo;

	public UserInfoView(){
		// Initialization of the VerticalPanel that split the header and the view content
		VerticalPanel splitPanel = new VerticalPanel();
		initWidget(splitPanel);
		splitPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);

		// Header panel which possibly can allow navigation 
		HorizontalPanel headerPanel = new HorizontalPanel();
		headerPanel.setHorizontalAlignment(HasHorizontalAlignment.ALIGN_CENTER);
		headerPanel.setStyleName("headerPanel");
		headerPanel.setSpacing(10);
		loginButton = new Button("Login !");
		userInfo = new Label("Ananymous");
		homeButton = new Button("Home");
		headerPanel.add(homeButton);
		headerPanel.add(userInfo);
		headerPanel.add(loginButton);
		
		DecoratorPanel unserInfoTableDecorator = new DecoratorPanel();
		unserInfoTableDecorator.setWidth("100%");
		unserInfoTableDecorator.setWidth("18em");
	}
	
	public HasClickHandlers getHomeButton() {
		return homeButton;
	}
	
	public Widget asWidget() {
		return this;
	}
	
}
